using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Domain.Entidades;
namespace Data.Models.Mapping
{
    public class VW_usuariosMap : EntityTypeConfiguration<VW_usuarios>
    {
        public VW_usuariosMap()
        {
            // Primary Key
            this.HasKey(t => new { t.usu_codigo, t.sta_descricao, t.car_descricao, t.uni_descricao, t.uni_codigo, t.car_codigo, t.sta_codigo, t.set_codigo, t.set_descricao, t.usu_senha, t.car_descricao_abreviado });

            // Properties
            this.Property(t => t.usu_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.usu_nome)
                .HasMaxLength(100);

            this.Property(t => t.usu_login)
                .HasMaxLength(100);

            this.Property(t => t.usu_email)
                .HasMaxLength(70);

            this.Property(t => t.sta_descricao)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.car_descricao)
                .IsRequired()
                .HasMaxLength(153);

            this.Property(t => t.uni_descricao)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.uni_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.car_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.sta_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.set_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.set_descricao)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.usu_tel)
                .HasMaxLength(12);

            this.Property(t => t.usu_icq)
                .HasMaxLength(9);

            this.Property(t => t.usu_ramal)
                .HasMaxLength(4);

            this.Property(t => t.usu_senhaicq)
                .HasMaxLength(50);

            this.Property(t => t.usu_senhaemail)
                .HasMaxLength(50);

            this.Property(t => t.usu_samba)
                .HasMaxLength(30);

            this.Property(t => t.usu_senhasamba)
                .HasMaxLength(30);

            this.Property(t => t.usu_senha)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(16);

            this.Property(t => t.uni_cidade)
                .HasMaxLength(50);

            this.Property(t => t.uni_estado)
                .HasMaxLength(2);

            this.Property(t => t.car_descricao_abreviado)
                .IsRequired()
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("VW_usuarios");
            this.Property(t => t.usu_codigo).HasColumnName("usu_codigo");
            this.Property(t => t.usu_nome).HasColumnName("usu_nome");
            this.Property(t => t.usu_login).HasColumnName("usu_login");
            this.Property(t => t.usu_email).HasColumnName("usu_email");
            this.Property(t => t.sta_descricao).HasColumnName("sta_descricao");
            this.Property(t => t.car_descricao).HasColumnName("car_descricao");
            this.Property(t => t.uni_descricao).HasColumnName("uni_descricao");
            this.Property(t => t.uni_codigo).HasColumnName("uni_codigo");
            this.Property(t => t.car_codigo).HasColumnName("car_codigo");
            this.Property(t => t.sta_codigo).HasColumnName("sta_codigo");
            this.Property(t => t.usu_datainclusao).HasColumnName("usu_datainclusao");
            this.Property(t => t.usu_datadesligamento).HasColumnName("usu_datadesligamento");
            this.Property(t => t.set_codigo).HasColumnName("set_codigo");
            this.Property(t => t.set_descricao).HasColumnName("set_descricao");
            this.Property(t => t.usu_tel).HasColumnName("usu_tel");
            this.Property(t => t.usu_icq).HasColumnName("usu_icq");
            this.Property(t => t.usu_ramal).HasColumnName("usu_ramal");
            this.Property(t => t.usu_senhaicq).HasColumnName("usu_senhaicq");
            this.Property(t => t.usu_senhaemail).HasColumnName("usu_senhaemail");
            this.Property(t => t.usu_samba).HasColumnName("usu_samba");
            this.Property(t => t.usu_senhasamba).HasColumnName("usu_senhasamba");
            this.Property(t => t.usu_senha).HasColumnName("usu_senha");
            this.Property(t => t.uni_cidade).HasColumnName("uni_cidade");
            this.Property(t => t.uni_estado).HasColumnName("uni_estado");
            this.Property(t => t.car_descricao_abreviado).HasColumnName("car_descricao_abreviado");
        }
    }
}
